class User {
    private final String name;

    public User(@Nullable String userName) { 
        this.name = Objects.requireNonNullElse(userName,"defaultName"); 
    }

    @Override
    public String toString() {
         return "User{name='" + (name != null ? name : "") + "'}";
    }
}